package com.aviccxzx.smarthome.UserModule;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;

import com.aviccxzx.smarthome.R;
import com.aviccxzx.smarthome.base.GosUserModuleBaseActivity;


/**
 * Created by joey on 2016/10/25.
 */
public class SplashActivity extends GosUserModuleBaseActivity implements View.OnClickListener {

    private Handler handler = new Handler() {
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case 1:
                    startActivity(new Intent(SplashActivity.this,
                            GuideLayFragment.class));
                    SplashActivity.this.finish();
                    break;
                case 2:
                    //为了安全考虑，需要用户每次进去都要进行登录操作
                    //只有点击了 退出登录 ，才需要再次登录
                    startActivity(new Intent(SplashActivity.this,
                            GosUserLoginActivity.class));
                    SplashActivity.this.finish();
                    break;
                case 3:
                    startActivity(new Intent(SplashActivity.this, MainAct.class));
                    SplashActivity.this.finish();
                    break;
            }
        }

    };
    String name;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            setContentView(R.layout.splash_lay_v19);
        } else {
        }
        boolean isFirst = spf.getBoolean("first", true);

        spf.edit().putBoolean("first", false).commit();

        if (isFirst) {
            handler.sendEmptyMessageDelayed(1, 3000);
        } else {
            handler.sendEmptyMessageDelayed(2, 3000);
        }
    }



    @Override
    public void onClick(View view) {
        switch (view.getId()) {
        }
    }
}
